/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package action.organization;

import com.opensymphony.xwork2.ActionSupport;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import myUtils.Utils;
import org.apache.struts2.interceptor.ServletRequestAware;
import service.OrgService;

/**
 *
 * @author luyang
 */
public class DeleteMemberAction extends ActionSupport implements ServletRequestAware
{
    private OrgService orgService;
    private HttpServletRequest request;

    public String execute()
    {
        int user_id;
        int org_id;
        String msg;

        Utils.getPreURL(request);

        if(request.getParameter("user_id")==null||request.getParameter("org_id")==null)
        {
            msg="user_id or org_id null";
            request.setAttribute("msg", msg);
            return ERROR;
        }
        user_id=Integer.parseInt(request.getParameter("user_id"));
        org_id=Integer.parseInt(request.getParameter("org_id"));

        orgService.deleteMemFromOrg(user_id, org_id);
        msg="success delete!";
        request.setAttribute("msg", msg);

        return SUCCESS;
    }

    public void setOrgService(OrgService orgService)
    {
        this.orgService=orgService;
    }

    public void setServletRequest(HttpServletRequest request)
    {
        this.request=request;
    }

}
